/*!
 * Copyright (c) 2023-present StarDreamNet
 */
(document.loader || (document.loader = [])).push(["login", function (require, exports, module) {
    $('.app-login-form-commit').click(function () {
        var email = $('#email').val();
        var password = $('#password').val();
        var url = '/api/bcm_login';

        $.post(url, {
            identity: email,
            password: password
        }).done(function (data) {
            data = JSON.parse(data)
            if (data.code == 200) {
                swal.skip({
                    title: "登录成功"
                });
            } else if (data.code == 403) {
                swal("登录失败", data.msg, "error");
            } else {
                swal("登录失败", "账户不存在！", "error");
            }
        }).fail(function () {
            swal("登录失败", "请稍后重试", "error");
        });
    });
}]);